<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>Hello MUI</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<!--标准mui.css-->
		<link rel="stylesheet" href="../css/mui.min.css">
		<!--App自定义的css-->
		<!--<link rel="stylesheet" type="text/css" href="../css/app.css" />-->
		<style>
			#info {
				padding: 20px 10px;
			}
			
			.mui-btn {
				font-size: 16px;
				padding: 8px;
				margin: 3px;
			}
		</style>

	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">native模式</h1>
		</header>
		<div class="mui-content">
			
 			<div class="mui-content-padded">
				<h5 class="mui-content-padded">日期示例</h5>
				<button id='pickDateBtn' type="button" class="mui-btn mui-btn-block">选择日期</button>
				<h5 class="mui-content-padded">时间示例</h5>
				<button id='pickTimeBtn' type="button" class="mui-btn mui-btn-block">选择时间</button>
				<div id="info"></div>
			</div>
		</div>
		<script src="../js/mui.min.js"></script>
		<script type="text/javascript" charset="utf-8">
			 //mui初始化
			mui.init({
				swipeBack: true //启用右滑关闭功能
			});
			var info = document.getElementById("info");
			
			document.getElementById("pickDateBtn").addEventListener('tap', function() {
				var dDate = new Date();
				dDate.setFullYear(2014, 7, 16);
				var minDate = new Date();
				minDate.setFullYear(2010, 0, 1);
				var maxDate = new Date();
				maxDate.setFullYear(2016, 11, 31);
				plus.nativeUI.pickDate(function(e) {
					var d = e.date;
					info.innerText = '您选择的日期是:' + d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate();
				}, function(e) {
					info.innerText = "您没有选择日期";
				}, {
					title: "请选择日期",
					date: dDate,
					minDate: minDate,
					maxDate: maxDate
				});
			})
			 document.getElementById("pickTimeBtn").addEventListener('tap', function() {
				var dTime = new Date();
				dTime.setHours(6, 0);
				plus.nativeUI.pickTime(function(e) {
					var d = e.date;
					info.innerText = "您选择的时间是：" + d.getHours() + ":" + d.getMinutes();
				}, function(e) {
					info.innerText = "您没有选择时间"
				}, {
					title: "请选择时间",
					is24Hour: true,
					time: dTime
				});
			});
		</script>
	</body>

</html>